<template>
<div>
  <Header :title=title><i class="el-icon-arrow-left" @click="$global.goPage('/mine')"></i> </Header>
<music-com-card :comment="MyCom"></music-com-card>
</div>
</template>

<script>
import Header from "../../../components/Header";
import MusicComCard from "../../music/Player/MusicComCard";
import {mapState} from "vuex";

export default {
  name: "MusCom",
  components: {MusicComCard, Header},
  data(){
    return{
      title:this.$route.params.title,
      OldCom:[],
      MyCom:[],
    }
  },
  created() {
    if(sessionStorage.getItem('MusOldCom')){
      this.OldCom=JSON.parse(sessionStorage.getItem('MusOldCom'))
    }else {
      this.OldCom=[]
    }

    this.title==="我的评论"?this.MyCom=this.MusCommentByUser:this.MyCom=this.OldCom
  },
  computed:{...mapState({
      MusCommentByUser:state=>state.music.MusCommentByUser,
    })},
  beforeCreate() {
    this.$store.dispatch('music/musLocalComByUser',
      window.localStorage.getItem('id'))
  },
}
</script>

<style scoped>
.el-button{
  background:#b3d4fc;
}
</style>
